package com.xingbg.projectimpl.provider.custom;

import com.xingbg.projectimpl.config.EnableCustomService;
import com.xingbg.projectimpl.provider.api.service.TestDubboService;
import com.xingbg.projectimpl.provider.business.config.SpringContextHolder;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

@EnableCustomService
@SpringBootApplication(scanBasePackages = "com.xingbg.projectimpl")
public class CustomProviderApp implements ApplicationListener<ContextRefreshedEvent> {

    public static void main(String[] args) {
        SpringApplication.run(CustomProviderApp.class,args);
    }

    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
//        List<TestDubboService> beansForType = SpringContextHolder.getBeansForType(TestDubboService.class);
//        for(TestDubboService testDubboService : beansForType){
//            System.out.println(testDubboService);
//        }
//        TestDubboService testDubboServiceImpl = SpringContextHolder
//                .getBean(TestDubboService.class, "testDubboServiceImpl");
//        System.out.println("testDubboServiceImpl="+testDubboServiceImpl);
//        TestDubboService customTestDubboServiceImpl = SpringContextHolder
//                .getBean(TestDubboService.class, "customTestDubboServiceImpl");
//        System.out.println("customTestDubboServiceImpl="+customTestDubboServiceImpl);
    }
}
